﻿Public Class LoginForm1
    Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
        If USUARIOTextBox.Text = "" Or SENHATextBox.Text = "" Then
            MsgBox("FAVOR INFORMAR LOGIN/SENHA")
        Else
            LOGINTableAdapter.FillByUSUARIOSENHA(LOGINDataSet.LOGIN, USUARIOTextBox.Text, SENHATextBox.Text)
        End If
        If LOGINDataSet.Tables(0).Rows.Count > 0 Then
            GroupBox1.Visible = True
            If GRUPOComboBox.Text <> "MASTER" And STATUSLabel1.Text = "LOGADO" Then
                MsgBox("USUÁRIO JÁ LOGADO")
            Else
                Try
                    STATUSLabel1.Text = "LOGADO"
                    LOGINBindingSource1.EndEdit()
                    Me.TableAdapterManager.UpdateAll(Me.LOGINDataSet)
                Catch ex As Exception
                    MsgBox("ERRO AO LOGAR O USUÁRIO")
                End Try
                GroupBox1.Visible = True
                Me.Hide()
                Principal.Show()
            End If
        Else
            MsgBox("USUÁRIO OU SENHA INVÁLIDOS FAVOR VERIFICAR")
        End If
    End Sub
    Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
        Me.Close()
    End Sub
End Class
